package com.cw2.structural.adapter.obj;

import com.cw2.structural.adapter.Player;
import com.cw2.structural.adapter.Translator;
import com.cw2.structural.adapter.Zh_JPTranslator;

/**
 * 组合的方式：对象结构模型,适配转换到了翻译器的功能上
 * （集成、组合）、封装、多态
 */
public class JPMoviePlayerAdapter implements Player {
    private Translator translator = new Zh_JPTranslator();

    private Player player;
    public JPMoviePlayerAdapter(Player player) {
        this.player = player;
    }

    @Override
    public String play() {
        String play = player.play();
        String translate = translator.translate(play);
        System.out.println(translate);
        return play;
    }
}
